package com.offcn;

import org.csource.common.MyException;
import org.csource.fastdfs.*;

import java.io.IOException;

public class UploadTest {

    public static void main(String[] args) throws IOException, MyException {
        // 1、 加载配置文件
        ClientGlobal.init("E:\\gitRepository\\dongyimai-parent\\dongyimai-service\\dongyimai-file-service\\src\\main\\resources\\fast_client.conf");
        // 2. 创建一个TrackerClient
        TrackerClient trackerClient = new TrackerClient();
        // 3. 使用TrackerClient创建连接
        TrackerServer trackerServer = trackerClient.getConnection();
        // 4. 创建StorageServer  创建一个对象的引用
        StorageServer storageServer = null;
        // 5. 创建storageClient
        StorageClient storageClient = new StorageClient(trackerServer,storageServer);
        // 使用storageClient 进行上传
        String[] jpgs = storageClient.upload_file("E:\\img\\10.jpg", "jpg", null);

        for (String jpg : jpgs) {
            System.out.println(jpg);
        }
    }
}
